pandas convert date column to year and month

23

df['StartDate'].dt.to_period('M')

result:

0    2021-08
1    2021-08
2    2021-08

Comments

Submit
0 Comments